{extend name="admin@public/base_content" /}
{block name="body">}
<body>
{include file="admin@public/common" /}
<div class="container-fluid larry-wrapper">
    <div class="row">
        <div class="col-xs-12 col-sm-12 col-md-12">
            <section class="panel panel-padding">
                <form id="form1" class="layui-form layui-form-pane" action="{:url('')}">
                    <div class="layui-tab" lay-filter="check">
                        <ul class="layui-tab-title">
                            <li class="layui-this" lay-id="1">基本信息</li>
                            <li lay-id="2">扩展信息</li>
                        </ul>
                        <div class="layui-tab-content">
                            <div class="layui-tab-item layui-show">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">上级栏目</label>
                                    <div class="layui-input-inline">
                                        <select name="parent_id">
                                            <option value="0">顶级栏目</option>
                                            {foreach name="categoryList" item="vo"}
                                            <option value="{$vo.class_id}" {if condition="$vo.class_id eq $info.parent_id"}selected{/if}>{$vo.cname}</option>
                                            {/foreach}
                                        </select>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">栏目名称</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="name" value="{$info.name|default=''}" jq-verify="required" jq-error="请输入栏目名称" placeholder="请输入栏目名称" class="layui-input ">
                                    </div>
                                </div>
                                <div class="layui-form-item" pane>
                                    <label class="layui-form-label">栏目属性</label>
                                    <div class="layui-input-inline">
                                        <input type="radio" name="type" {eq name="info.type" value="1"}checked{/eq} title="列表" value="1" checked/>
                                        <input type="radio" name="type" {eq name="info.type" value="0"}checked{/eq} title="频道" value="0" />
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">内容分页数</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="page"  jq-verify="number" value="{$info.page|default='10'}" jq-error="排序必须为数字" placeholder="分类排序" class="layui-input ">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">排序</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="sequence"  jq-verify="number" value="{$info.sequence|default='0'}" jq-error="排序必须为数字" placeholder="分类排序" class="layui-input ">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">栏目模板</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="class_tpl" id="class_tpl" value="{$info.class_tpl|default='list'}"  class="layui-input ">
                                    </div>
                                    <div class="layui-input-inline">
                                        <select jq-error="请选择" lay-filter="class_tpl">
                                            <option value=""></option>
                                            {foreach name='tplList' item='vo'}
                                            <option value="{$vo.name}" {if condition="$vo.name eq $info.class_tpl"}selected{/if}>{$vo.file}</option>
                                            {/foreach}
                                        </select>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">内容模板</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="content_tpl" id="content_tpl" value="{$info.content_tpl|default='content'}"  class="layui-input ">
                                    </div>
                                    <div class="layui-input-inline">
                                        <select jq-error="请选择" lay-filter="content_tpl">
                                            <option value=""></option>
                                            {foreach name='tplList' item='vo'}
                                            <option value="{$vo.name}" {if condition="$vo.name eq $info.content_tpl"}selected{/if}>{$vo.file}</option>
                                            {/foreach}
                                        </select>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">栏目图片</label>
                                    <div class="layui-input-block">
                                        <input type="file" name="image" class="layui-upload-file" id="upload_one">
                                        <input type="hidden" name="image" value="{$info.image|default=''}" jq-error="请上传栏目图片" error-id="img-error">
                                        <p id="img-error" class="error"></p>
                                    </div>
                                    {notempty name="info.image"}
                                    <div class="layui-input-block">
                                        <div class="imgbox"><img src="{$info.image|default=''}" alt="..." class="img-thumbnail"></div>
                                    </div>
                                    {/notempty}
                                </div>
                                <div class="layui-form-item" pane>
                                    <label class="layui-form-label">栏目状态</label>
                                    <div class="layui-input-inline">
                                        <input type="radio" name="show" {eq name="info.show" value="1"}checked{/eq} title="显示" value="1" checked />
                                        <input type="radio" name="show" {eq name="info.show" value="2"}checked{/eq} title="关闭" value="2" />
                                    </div>
                                </div>

                                <div class="layui-form-item layui-form-text">

                                    <div class="layui-input-block">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-tab-item">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">子标题</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="subname" value="{$info.subname|default=''}" jq-error="请输入子标题" placeholder="请输入子标题" class="layui-input ">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">栏目URL</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="urlname" value="{$info.urlname|default=''}" jq-error="请输入栏目URL" placeholder="请输入栏目RUL" class="layui-input ">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">栏目关键词</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="keywords" value="{$info.keywords|default=''}" jq-error="请输入栏目URL" placeholder="请输入栏目RUL" class="layui-input ">
                                    </div>
                                </div>
                                <div class="layui-form-item ">
                                    <label class="layui-form-label">栏目描述</label>
                                    <div class="layui-input-block">
                                        <textarea name="description" placeholder="请输入栏目描述" class="layui-textarea">{$info.description|default=''}</textarea>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">列表排序</label>
                                    <div class="layui-input-inline">
                                        <select name="content_order" jq-verify="" jq-error=" 发布时间新->旧" lay-filter="verify">
                                            <option value=""> 发布时间新->旧</option>
                                            <option value="time DESC" {eq name="info.content_order" value="time DESC"}selected{/eq}> 发布时间新-&gt;旧</option>
                                            <option value="time ASC" {eq name="info.content_order" value="time ASC"}selected{/eq}> 发布时间 旧-&gt;新</option>
                                            <option value="sequence DESC" {eq name="info.content_order" value="sequence DESC"}selected{/eq}> 自定义排序 大-&gt;小</option>
                                            <option value="sequence ASC" {eq name="info.content_order" value="sequence ASC"}selected{/eq}> 自定义排序 小-&gt;大</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">绑定字段集</label>
                                    <div class="layui-input-inline">
                                        <select name="fieldset_id" jq-verify="" jq-error="绑定字段集" lay-filter="verify">
                                            <option value="0">请选择</option>
                                            {foreach name='expandList' item='vo'}
                                            <option value="{$vo.fieldset_id}" {if condition="$vo.fieldset_id eq $info.fieldset_id"}selected{/if}>{$vo.name}</option>
                                            {/foreach}
                                        </select>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">网站外链</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="out_url" value="{$info.out_url|default=''}" jq-error="请输入网站外链" placeholder="请输入网站外链" class="layui-input ">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <input type="hidden" name="class_id" value="{$info.class_id|default=''}">
                            <button class="layui-btn" jq-submit lay-filter="submit" jq-tab="true">立即提交</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>
                </form>
            </section>
        </div>
    </div>
</div>
</body>
{/block}
{block name="script"}
<script>
    layui.use('myform', function(){
        var form = layui.form();
        //各种基于事件的操作，下面会有进一步介绍
        form.on('select(class_tpl)', function(data){
            document.getElementById("class_tpl").value=data.value;
        });
        form.on('select(content_tpl)', function(data){
            document.getElementById("content_tpl").value=data.value;
        });
    });

</script>
{/block}